<?php 
	$ip = $_SERVER["REMOTE_ADDR"]; 
	$date = date("Y-m-d  H-i-s");
	$url = $_SERVER['REQUEST_URI'];
	$info = $_SERVER['HTTP_USER_AGENT']." ".(isset($_SERVER['HTTP_REFERER'])?('(rfl)'.$_SERVER['HTTP_REFERER']):'')." ".getenv('HTTP_X_FORWARDED_FOR');

	if(!mysql_query("CREATE TABLE IF NOT EXISTS stat_table (id int(6) NOT NULL auto_increment, ip varchar(16) NOT NULL, datetime datetime NOT NULL,url varchar(256) NOT NULL,info varchar(256) NOT NULL, PRIMARY KEY (id), INDEX(ip));"))echo 'Unable to create stat table';

	mysql_query("insert into stat_table (ip,datetime,url,info) values ('$ip','$date','$url','$info');");

?>